#include "Animate.h"
#include "config.h"

#if ANIMATE_CHOICE != 0
int Animate_key = -1; //初始化图标显示帧数
#endif

#if ANIMATE_CHOICE == 1
#include "img/astronaut.h"
#elif ANIMATE_CHOICE == 2
#include "img/hutao.h"
#elif ANIMATE_CHOICE == 3
#include "img/sayu.h"
#endif

const char* img[16] = {
    "/sayu/sayu_0.jpg",
    "/sayu/sayu_1.jpg",
    "/sayu/sayu_2.jpg",
    "/sayu/sayu_3.jpg",
    "/sayu/sayu_4.jpg",
    "/sayu/sayu_5.jpg",
    "/sayu/sayu_6.jpg",
    "/sayu/sayu_7.jpg",
    "/sayu/sayu_8.jpg",
    "/sayu/sayu_9.jpg",
    "/sayu/sayu_10.jpg",
    "/sayu/sayu_11.jpg",
    "/sayu/sayu_12.jpg",
    "/sayu/sayu_13.jpg",
    "/sayu/sayu_14.jpg",
    "/sayu/sayu_15.jpg"
};

void imgAnim(const uint8_t **Animate_value, uint32_t *Animate_size)
{
#if ANIMATE_CHOICE != 0
    Animate_key++;
#endif

//太空人起飞
#if ANIMATE_CHOICE == 1
    *Animate_value = astronaut[Animate_key];
    *Animate_size = (uint32_t)astronaut_size[Animate_key];
    if (Animate_key >= 9)
        Animate_key = -1;
//胡桃摇
#elif ANIMATE_CHOICE == 2
    *Animate_value = hutao[Animate_key];
    *Animate_size = hutao_size[Animate_key];
    if (Animate_key >= 31)
        Animate_key = -1;
// 早柚
#elif ANIMATE_CHOICE == 3
    *Animate_value = sayu[Animate_key];
    *Animate_size = (uint32_t)sayu[Animate_key];
    if (Animate_key >= 15)
        Animate_key = -1;
#endif
}

void getImgName(const char** imgName)
{
    ++Animate_key;
    *imgName = img[Animate_key];
    if (Animate_key >= 15)
        Animate_key = -1;
}